package cn.dy.sbo.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Component;
import org.springside.modules.orm.hibernate.HibernateDao;

import cn.dy.sbo.api.FlowDao;
import cn.dy.sbo.model.Flow;
import cn.dy.sbo.vo.DropListVO;

@Component
public class FlowDaoHibernate extends HibernateDao<Flow, Long> implements FlowDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<DropListVO> getByCat(Long id) {
		Query query = super.getSession().createQuery("select id as id,code as code,name as name,enname as enname from Flow where type.id= " + id);
		
		List<DropListVO> list = (List<DropListVO>) query.setResultTransformer(Transformers.aliasToBean(DropListVO.class)).list();
		return list;
	}

}
